/*
 * @Author: your name
 * @Date: 2021-10-24 15:56:59
 * @LastEditTime: 2021-10-24 18:08:53
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /柳橙/拆单红冲/yongyou_zj5j_separatebill/src/components/messageBox/messageBox.js
 */
import Vue from 'vue'
//导入步骤1新建的vue组件
import messageBox from './messageBox.vue'

let MessageBox=(opt)=>{
    let myComp=Vue.extend(messageBox)

    let vm=new myComp({
        el:document.createElement('div'),
        data:{
            result:opt.result,  //是否显示弹窗
            resultType:opt.resultType,  //结果类型弹窗.success,errer
            title:opt.title ,     //标题
            content:opt.content ,   //内容
            confirm:opt.confirm||false , //显示确定按钮
            cancel:opt.cancel||false ,   //显示取消按钮
        },
        methods:{
            messageTest(){
                if(opt.handleOk){
                    opt.handleOk()   //回调函数
                    document.body.removeChild(vm.$el)  // 关闭
                }
            }
        }
    })
    document.body.appendChild(vm.$el)
}

export default{
    install(Vue){
        Vue.prototype.messageBox=MessageBox
    }
}
